﻿<%@ Page Language="C#"  AutoEventWireup="true" CodeBehind="ManageArticleHome.aspx.cs" Inherits="KerriganBlog.ManageArticleHome" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>


  <script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
  <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
  <script type="text/javascript" src="Scripts/jquery.lightbox_me.js"></script>
  <script type="text/javascript" src="Scripts/jquery.simplemodal-1.4.1.js"></script>

   <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
  <link href="App_Themes/Theme1/ManageArticleHome.css" rel="Stylesheet" type="text/css" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">


<head runat="server">


<style type="text/css">
   
   
</style>
       <script language="javascript" type="text/javascript">

           function ShowEditModal(articleId) {
               var frame = $get('IframeEdit');
               frame.src = "EditArticle.aspx?Activity=edit&ID=" + articleId;
               $get('buttonNoUse').click();

               $find('modalpopup').show();
           }

   function ShowNewModal() {
        var frame = $get('IframeEdit');
        frame.src = "EditArticle.aspx?Activity=new";
        $get('buttonNoUse').click();

        $find('modalpopup').show();
    }

    function EditCancelScript() {
        RefreshDataGrid();
    }
    function EditOkayScript() {
        RefreshDataGrid();
    }

    function RefreshDataGrid() {
        $get('btnSearch').click();
    }



</script>


    <title></title>
</head>
<body >
    <div id="header">
    <div id="title">MANAGE BLOG KERRIGAN</div>
    </div>
    <div id="bodyContainer" style="width:1200px;margin-left:200Px;margin-top:50px">
    <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        


         <div id="left">
                <div style="background-color:#D3D3D3;height:40px;font-size:25px;text-align:center" >Menu</div>
                  <table>
                
                    <tr>
                        <td>  
                            <asp:LinkButton ID="LinkButton2" runat="server" PostBackUrl="~/Login.aspx">Login</asp:LinkButton>
                        </td>
                    </tr>

                    <tr>
                        <td>  
                            <asp:LinkButton ID="LinkButton3" runat="server" PostBackUrl="~/Home.aspx">Home</asp:LinkButton>
                        </td>
                    </tr>
                    </table>
 
         </div>

         <div id="right" >
                <div style="background-color:#D3D3D3;height:40px;font-size:25px; text-align:center" >Category</div>
                 <table>
                
                    <tr>
                        <td>  
                            <asp:LinkButton ID="idMoto" runat="server" PostBackUrl="~/MotoPage.aspx">Moto</asp:LinkButton>
                        </td>
                    </tr>
                    <tr>
                        <td>  
                            <asp:LinkButton ID="idAuto" runat="server" PostBackUrl="~/CarPage.aspx">Car</asp:LinkButton>
                        </td>
                    </tr>

                    <tr>
                        <td>  
                            <asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="~/RoadSafetyPage.aspx">Road Safety</asp:LinkButton>
                        </td>
                    </tr>
                </table>
         </div>

         <div id="middle" style="width : 700px">
        <%--<div id="container" style="float:right;width:800px">--%>
        <asp:Button ID="btnSearch" runat="server" Text="ReloadGrid"  onclick="btnSearch_Click"/>

        <div class="GridContainer">
        <asp:UpdatePanel runat="server" >
        

            <ContentTemplate>

                <asp:Button ID="btn_add" runat="server" Text="Add Article" onclick="btn_add_Click" />
               <%-- <input type="button" runat="server" value="Add Article" id="btn_add" onclick="btn_add_Click()"/>--%>
                


        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" ForeColor="#333333" GridLines="None"
                           ShowFooter="True" Width="100%"
            onselectedindexchanged="GridView1_SelectedIndexChanged" OnRowCommand="GridView1_RowCommand"  OnRowDataBound="GridView1_RowDataBound"
            AllowPaging="true"   OnPageIndexChanging="test" >

            <Columns>
                <asp:TemplateField HeaderText="ID" HeaderStyle-HorizontalAlign="Left" Visible="false">
                
                    <ItemTemplate>
                       
                        <asp:Label ID="LabelID" runat="server" Text='<%# Bind("IdBlogArticle") %>'/>

                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Title" HeaderStyle-HorizontalAlign="Left">
                
                    <ItemTemplate>
                       
                        <asp:Label ID="LabelTitle" runat="server" Text='<%# Bind("Title") %>'/>

                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField HeaderText="Date" HeaderStyle-HorizontalAlign="Left">
                
                    <ItemTemplate>
                    
                        <asp:Label ID="LabelDate" runat="server" Text='<%# Bind("Date") %>'/>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField HeaderText="Category" HeaderStyle-HorizontalAlign="Left">
                
                    <ItemTemplate>
                    
                        <asp:Label ID="LabelName" runat="server" Text='<%# Bind("Name") %>'/>
                    </ItemTemplate>
                </asp:TemplateField>


                <asp:TemplateField HeaderText="Action" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <!--<asp:ButtonField ButtonType="Button" CommandName="Select" Text="ddddd" />  <asp:CommandField ButtonType="Button" ShowSelectButton="true" />
                        <asp:Button ID="dsds" runat="server" Text="Modify" CommandName="Select"  CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" />-->



                <asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="false" CommandName="" Text="Edit" ></asp:LinkButton>
                <asp:LinkButton ID="lnkDelete" runat="server" CausesValidation="false" CommandName="MyDelete" Text="Delete"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>

            </Columns>

                          <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                          <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                          <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                          <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                          <EditRowStyle BackColor="#999999" />
                          <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
                    </ContentTemplate>
                    <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
                 </Triggers>
        </asp:UpdatePanel>

        </div>
        
    
                        <asp:button id="buttonNoUse" runat="server" text="Button" style="display:none" />

                        <asp:modalpopupextender id="ModalPopupExtenderDisplay" runat="server" 
	                        cancelcontrolid="ButtonEditCancel" okcontrolid="ButtonEditDone" 
	                        targetcontrolid="buttonNoUse" popupcontrolid="DivEditWindow" 
	                        popupdraghandlecontrolid="PopupHeader" drag="true" 
	                        backgroundcssclass="ModalPopupBG" BehaviorID="modalpopup"
                            OnCancelScript="EditCancelScript();" OnOkScript="EditOkayScript();">
                        </asp:modalpopupextender>

                        <asp:panel id="PanelPopup" style="display: none" runat="server">
	                        <div class="HellowWorldPopup">
                                <fieldset >
                                    <legend>Manage Article</legend>
                                        <div class="PopupHeader" id="PopupHeader">Header</div>
                                        <div class="PopupBody">
                                            <p>This is a simple modal dialog</p>
                                        </div>
                                        <div class="popup_Buttons">
                                           <input id="ButtonEditDone" value="Done" type="button" />
                                          <input id="ButtonEditCancel" value="Cancel" type="button" />
		                        </div>
                                </fieldset>
                            </div>
                        </asp:panel>


                      <div id="DivEditWindow" style="display: none;margin-top:-150px;margin-left:-150px;" class="popupConfirmation">
                          <iframe id="IframeEdit" frameborder="0" height="500" scrolling="no" width="800" >
                          </iframe>
                      </div>

        </div>

    </form>
    </div>
</body>
</html>
